import { http } from '@/utils'

export type Menu = {
    id: number
    parentId: number
    icon: ''
    alwaysShow: boolean
    children: Menu[] | null
    component: string
    componentName: string
    keepAlive: boolean
    name: string
    path: string
    visible: boolean
}

export type User = {
    id: number
    nickname: string
    avatar: string
}

export type PermissionResp = {
    menus: Menu[]
    permissions: string[]
    roles: string[]
    user: User
}

/**
 * 权限列表（菜单列表）
 */
 export const fetchPermissionListAPI = (params: PermissionResp) => {
    return http<PermissionResp>({
        url: 'system/auth/get-permission-info',
        params
    })
}